package com.csx.base.design.constructor.singleton;

import java.util.concurrent.ConcurrentHashMap;

/**
 * 多例模式
 * @author cuisongxu
 * @date 2023/3/27 18:36
 */
public class Logger {

    private static final ConcurrentHashMap<String, Logger> instances = new ConcurrentHashMap<>();

    private Logger() {}

    public static Logger getInstance(String loggerName) {
        instances.putIfAbsent(loggerName, new Logger());
        return instances.get(loggerName);
    }

    public void log() {}

}
